package com.yenlien.traceyun.control.entity;

import com.yenlien.traceyun.webase.entity.BaseEntity;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 还款信息
 */
@Entity
@Table(name = "t_repayment")
@Data
public class Repayment extends BaseEntity {

    @Column(name = "name", length = 20)
    private String name;     //还款人

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "create_time")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;            //创建时间

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "repayment_time")
    @Temporal(TemporalType.TIMESTAMP)
    private Date repaymentTime;            //还款时间

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "actual_repayment_time")
    @Temporal(TemporalType.TIMESTAMP)
    private Date actualRepaymentTime;            //实际还款时间

    @Column(name = "repayment_num", length = 20)
    private String repaymentNum;               //还款期数

    @Column(name = "loan_period", length = 20)
    private int loanPeriod;               //还款总期数

    @Column(name = "amount", length = 20)
    private BigDecimal amount;     //应还金额

    @Column(name = "real_amount", length = 20)
    private BigDecimal realAmount;     //实际还款金额

    @Column(name = "surplus_amount", length = 20)
    private BigDecimal surplusAmount;     //剩余还款金额

    @Column(name = "repaid_amount", length = 20)
    private BigDecimal repaidAmount;     //已还款金额

    @Column(name = "surplusNum", length = 20)
    private int surplusNum;     //剩余期数

    @Column(name = "reviewer", length = 255)
    private String reviewer;            //审核人

    @Column(name = "rate", length = 255)
    private String rate;            //贷款利率

    @Column(name = "status", length = 20)
    private String status;              //状态   -1：逾期  0：待还款， 1：待审核  2.还款成功

    @Column(name = "loan_id", length = 255)
    private String loanId;            //申请贷款id

    @Column(name = "remarks", length = 255)
    private String remarks;            //备注

    @Column(name = "company_id", length = 255)
    private String companyId;            //公司ID

    @Column(name = "bankInfo_id", length = 255)
    private String bankInfoId;         //关联银行ID

    @Transient
    private String applyName;       //申请人姓名

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Temporal(TemporalType.TIMESTAMP)
    @Transient
    private Date applyTime;           //申请时间

    @Transient
    private BigDecimal applyAmount;           //申请金额

}
